﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using GameEngine.SceneGraph;

//--rifle
namespace Redland2
{
    public class Rifle : Gun
    {
        #region members
        private const float ACCURACY = 0.95F;
        private float _accuracyModifier = 0.0F;
        #endregion members

        #region properties
        #endregion properties

        #region constructors

        public Rifle(GameScene inputScene, int inputIndex, Player inputOwner, Vector2 position ): base( inputScene, inputIndex, inputOwner, position )
        {
            SetupGun();
        }

        private void SetupGun()
        {
            this.FireDelay = 75;
            this.Accuracy = ACCURACY;
            this.Damage = 5;
        }

        #endregion constructors

        #region methods

        public override void Update(GameTime gameTime)
        {
            if (_accuracyModifier <= -0.1F)
                _accuracyModifier += 0.1F;
            base.Update(gameTime);
        }

        public override void Fire()
        {
            if( _accuracyModifier > -ACCURACY)
                _accuracyModifier -= 0.2F;

            this.Accuracy = ACCURACY + _accuracyModifier;
            base.Fire();
        }

        #endregion methods 
    }
}
